unit u_Principal;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dxCore, dxButton, ExtCtrls, MMJPanel, RXCtrls, jpeg, Menus,
  UCBase;

type
  Tf_Principal = class(TForm)
    MMJPanel1: TMMJPanel;
    dxButton1: TdxButton;
    dxButton2: TdxButton;
    dxButton3: TdxButton;
    img1: TImage;
    RxLabel11: TRxLabel;
    mm1: TMainMenu;
    CadastrodeTransportadoras1: TMenuItem;
    Movimentao1: TMenuItem;
    ransportadoras1: TMenuItem;
    EntradadeCaminhes1: TMenuItem;
    EntradadeVeculosPessoas1: TMenuItem;
    Sistema1: TMenuItem;
    Sobre1: TMenuItem;
    Sair1: TMenuItem;
    UserControlComercial: TUserControl;
    Usuarios1: TMenuItem;
    Cadastro1: TMenuItem;
    rocarSenha1: TMenuItem;
    Logoof1: TMenuItem;
    procedure dxButton1Click(Sender: TObject);
    procedure dxButton3Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Sair1Click(Sender: TObject);
    procedure EntradadeCaminhes1Click(Sender: TObject);
    procedure ransportadoras1Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  f_Principal: Tf_Principal;

implementation

uses u_EntradaCM, uftransp, UDM;

{$R *.dfm}

procedure Tf_Principal.dxButton1Click(Sender: TObject);
begin
  f_EntradaCM.ShowModal;
end;

procedure Tf_Principal.dxButton3Click(Sender: TObject);
begin
   close;
end;

procedure Tf_Principal.FormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  if MessageDlg('Voce realmente deseja encerrar o sistema ?',mtConfirmation, [mbYes,mbNo],0) = mrYes then
     Application.Terminate
  else
    abort;
end;

procedure Tf_Principal.Sair1Click(Sender: TObject);
begin
 Close;
end;

procedure Tf_Principal.EntradadeCaminhes1Click(Sender: TObject);
begin
  f_EntradaCM.ShowModal;
end;

procedure Tf_Principal.ransportadoras1Click(Sender: TObject);
begin
 ftransp := Tftransp.Create(Application);
 try
   ftransp.ShowModal;
 finally
   ftransp.Free;
 end;   
end;

procedure Tf_Principal.FormShow(Sender: TObject);
begin
  UserControlComercial.AutoStart := True;
  UserControlComercial.Execute;
  usulog :=  f_Principal.UserControlComercial.CurrentUser.UserID;
  nome_user := f_Principal.UserControlComercial.CurrentUser.UserName;  
end;

end.
